home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr09
/
fgrtodb.zip
/
FGR_TO_D.TXT
< prev
next >
Wrap
Text File
|
1993-06-03
|
4KB
|
78 lines
July 15,1989
Putting PAF on 3x5 Index Cards, Continued
I read Don Wilson's article in the January/February 1989 digest for ideas on a
3x5 file card output. The PAF User Defined Report function, although useful,
doesn't include all the information, such as marriage information, one might
want to place on the index cards. I was looking for a way of reducing and
extracting the information contained on the Family Group Records (FGR) onto a
3x5 file card.
Within the past year, I've taken a job that requires me to use a Unix
operating system. I've found that there are a lot of extremely powerful text
processing tools in Unix. Among them are sed (stream editor) and awk (a text
processing language). Both of these tools have been ported to MS-DOS and can
be obtained as shareware from local electronic bulletin boards. The files I
downloaded are SEDMOD.ZIP and AWK212.ZIP.
Simplistically sed copies a named file, usually an ASCII text file, to
standard output (ASCII) and edits the file according to a script of commands.
Lines can be deleted, according to parameters and characters can be
changed/deleted. Likewise awk scans the input file for lines that match a set
of patterns specified in the program. With each pattern in the program there
can be an associated action that will be performed when a line of the file
matching the pattern. An input line is made up of fields separated by a field
separator (FS), usually a space. The fields are denoted by $1, $2, ...
The FGR is a very structured report which easily lends itself for reformatting
under sed and awk. My goal was to convert FGRs into a standard delimited file
that could be input into dBASE III+. Once in dBASE, I could produce the 3x5
index cards with the information I wanted. I was able to meet that goal.
This article will show you how you can convert your FGRs. Further
modification of the sed and awk programs maybe necessary if the output is to
be formatted differently or if additional data is needed for your research.
The first step is to decide what group of FGRs you wish to convert. PAF has
several options. You can use the Cascading Pedigree or the Range Print
feature to obtain the applicable FGRs. Select the option to print the report
to disk. Once on disk, there are two steps necessary to convert the parent
information and three steps to convert the children information. For my
purposes, I have assumed that all married children will have separate FGRs
printed. Therefore, only single children are extracted from the FGRs. If you
wish to extract all children from a FGR, then you only need to change one line
in the awk file.
Once on disk, use sed in conjunction with listing 1 to convert the FGRs into a
format that awk can use. I have chosen the colon to be the field separator
and have deleted all extraneous lines. Figure 1 represents the FGR before and
figure 2 represents the FGR after being processed by sed. The MS-DOS command
is:
sed -f paf.sed print.dat > print.txt
Once the file is converted, we then use awk with the program shown in listing
2 to extract and reformat the data into a format that dBASE can accept.
Figure 3 represents the formatted output, acceptable to dBASE. The MS-DOS
command is:
awk -f paf.awk print.txt > dbase.dat
Extracting the unmarried children from the same FGRs requires different sed
and awk programs (listings 3-5) and only three steps:
sed -f paf1.sed print.dat > print.txt
awk -f paf1.awk print.txt > dbase.txt
sed -f cleanup.sed dbase.txt > dbase.dat
The dbase.dat file produced than can be imported into dBASE III+. The
structure of the dBASE file is shown in figure 4.
To paraphrase Don Wilson, you now have a procedure to produce a structured
file that can be imported dBASE, or with changes, into any other format
desired. You also have the ability to extract other pertinent genealogical
information that may not be present in PAF User Defined Reports.
Steph Valentine